<?php
/*
 * @ https://EasyToYou.eu - IonCube v11 Decoder Online
 * @ PHP 7.2 & 7.3
 * @ Decoder version: 1.1.6
 * @ Release: 10/08/2022
 */

// Decoded file for php version 71.
if(!defined("PCLZIP_TEMPORARY_DIR")) {
    define("PCLZIP_TEMPORARY_DIR", PHPExcel_Shared_File::sys_get_temp_dir() . DIRECTORY_SEPARATOR);
}
require_once PHPEXCEL_ROOT . "PHPExcel/Shared/PCLZip/pclzip.lib.php";
class PHPExcel_Shared_ZipArchive
{
    private $tempDir;
    private $zip;
    const OVERWRITE = "OVERWRITE";
    const CREATE = "CREATE";
    public function open($fileName)
    {
        $this->tempDir = PHPExcel_Shared_File::sys_get_temp_dir();
        $this->zip = new PclZip($fileName);
        return true;
    }
    public function close()
    {
    }
    public function addFromString($localname, $contents)
    {
        $filenameParts = pathinfo($localname);
        $handle = fopen($this->tempDir . "/" . $filenameParts["basename"], "wb");
        fwrite($handle, $contents);
        fclose($handle);
        $res = $this->zip->add($this->tempDir . "/" . $filenameParts["basename"], PCLZIP_OPT_REMOVE_PATH, $this->tempDir, PCLZIP_OPT_ADD_PATH, $filenameParts["dirname"]);
        if($res == 0) {
            throw new PHPExcel_Writer_Exception("Error zipping files : " . $this->zip->errorInfo(true));
        }
        unlink($this->tempDir . "/" . $filenameParts["basename"]);
    }
    public function locateName($fileName)
    {
        $fileName = strtolower($fileName);
        $list = $this->zip->listContent();
        $listCount = count($list);
        $index = -1;
        for ($i = 0; $i < $listCount; $i++) {
            if(strtolower($list[$i]["filename"]) == $fileName || strtolower($list[$i]["stored_filename"]) == $fileName) {
                $index = $i;
                break;
            }
        }
        return -1 < $index ? $index : false;
    }
    public function getFromName($fileName)
    {
        $index = $this->locateName($fileName);
        if($index !== false) {
            $extracted = $this->getFromIndex($index);
        } else {
            $fileName = substr($fileName, 1);
            $index = $this->locateName($fileName);
            if($index === false) {
                return false;
            }
            $extracted = $this->zip->getFromIndex($index);
        }
        $contents = $extracted;
        if(is_array($extracted) && $extracted != 0) {
            $contents = $extracted[0]["content"];
        }
        return $contents;
    }
    public function getFromIndex($index)
    {
        $extracted = $this->zip->extractByIndex($index, PCLZIP_OPT_EXTRACT_AS_STRING);
        $contents = "";
        if(is_array($extracted) && $extracted != 0) {
            $contents = $extracted[0]["content"];
        }
        return $contents;
    }
}

?>